package com.abl.javabasis._06_面向对象;

class Person {
    public String name;

    public Person() {
        System.out.println("Person无参构造函数");
    }

    public Person(String name) {
        this.name = name;
        System.out.println("Person有参构造函数：" + name);
    }
}

class Student extends Person {

    public Student() {
        System.out.println("Student构造函数执行");
    }

    public Student(String name) {
        super(name);
        System.out.println("Student构造函数执行：" + name);
    }

}

class Teacher extends Person {

    public Teacher() {
        System.out.println("Teacher构造函数执行");
    }

    public Teacher(String name) {
        System.out.println("Teacher构造函数执行：" + name);
    }

}


public class 继承 {

    public static void main(String[] args) {

        //        Person无参构造函数
        //        Teacher构造函数执行
        Teacher teacher = new Teacher();

        //        Person无参构造函数
        //        Student构造函数执行
        Student student = new Student();

        //        Person无参构造函数
        //        Teacher构造函数执行：老师001
        Teacher teacher001 = new Teacher("老师001");


        //        Person有参构造函数：学生001
        //        Student构造函数执行：学生001
        Student student001 = new Student("学生001");


    }

}
